/*
day429 
2020.10.30 
*/
#include<cstring>
#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    int maxLengthBetweenEqualCharacters(string s) {
		int arr[26];
		for(int i=0;i<26;++i)
		{
			arr[i]=-1;
		}
		int res=-1;
		for(int i=0;i<s.size();++i)
		{
			int tem=s[i]-'a';
			if(arr[tem]==-1)
			{
				arr[tem]=i;
			}
			else
			{
				res=max(res,i-arr[tem]-1);
			}
		}
		
		return res;
    }
};


int main()
{
	return 0;
}
